package coreservlets;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SubmitInsuranceInfo extends HttpServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		InsuranceInfo info = new InsuranceInfo();
		BeanUtilities.populateBean(info, req);
		resp.setContentType("text/html");
		PrintWriter out = resp.getWriter();
		String docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 "
				+ "Transitional//EN\">\n";
		String title = "Insurance Info for " + info.getName();
		out.println(docType + "<HTML>\n" + "<HEAD><TITLE>" + title
				+ "</TITLE></HEAD>\n" + "<BODY BGCOLOR=\"#FDF5E6\">\n"
				+ "<CENTER>\n" + "<H1>" + title + "</H1>\n" + "<UL>\n"
				+ " <LI>Employee ID: " + info.getEmployeeID() + "\n"
				+ " <LI>Number of children: " + info.getNumChildren() + "\n"
				+ " <LI>Married?: " + info.isMarried() + "\n"
				+ "</UL></CENTER></BODY></HTML>");
	}

}
